<?php
define('IN_ECS', true);
require_once('./includes/Response.php');
require(dirname(__FILE__) . '/includes/init.php');


//$json = new JSON();
if ($_REQUEST['act'] == 'list') {
    $userlist = array();
    $friend_id = array();
//$user_id = $_POST['user_id'];
    $sql = "select friend_id FROM " . $ecs->table('friend') .
        " WHERE user_id = 1";
    $result = $db->query($sql);
    while ($friend = mysql_fetch_assoc($result)) {
        $friend_id[] = $friend;
    }
    foreach ($friend_id as $value) {
        //var_dump($value);
        $sql = "select * FROM" . $ecs->table('user') . "where uesr_id = '$value[friend_id]'";
        $result = $db->query($sql);
        while ($user = mysql_fetch_assoc($result)) {
            $userlist[] = $user;
        }
    }
//var_dump($userlist);
    $abc = Response::json(100, '数据返回成功', $userlist);
    echo $abc;
    return $abc;
}
/**
 * Created by PhpStorm.
 * User: tuhao
 * Date: 2016/10/20
 * Time: 9:31
 */